﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <ControlTemplate x:Key="ThumbnailButton" TargetType="{x:Type Button}">
        <Grid>
            <Ellipse Name="EllB" Stroke="Black" StrokeThickness="2" Cursor="Hand">
                <Ellipse.Fill>
                    <ImageBrush RenderOptions.BitmapScalingMode="LowQuality" ImageSource="{Binding imageUrl}" Stretch="Fill"></ImageBrush>
                </Ellipse.Fill>
                <Ellipse.Effect>
                    <DropShadowEffect RenderingBias="Performance" BlurRadius="20" Direction="-20" ShadowDepth="10"/>
                </Ellipse.Effect>
                <Ellipse.RenderTransform>
                    <TranslateTransform RenderOptions.BitmapScalingMode="LowQuality" x:Name="transformObj" X="0" Y="0"/>
                </Ellipse.RenderTransform>
            </Ellipse>
        </Grid>
        <ControlTemplate.Triggers>
            <EventTrigger RoutedEvent="Ellipse.Loaded">
                <BeginStoryboard>
                    <Storyboard RepeatBehavior="3x">
                        <DoubleAnimation Storyboard.TargetProperty="Y" From="0" To="10"
                                         AutoReverse="True" BeginTime="0:0:0" SpeedRatio="5"
                                         Storyboard.TargetName="transformObj" Duration="0:0:0.5"/>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
            <EventTrigger RoutedEvent="Button.Click"> <!-- Ellipse.MouseLeftButtonDown -->
                <EventTrigger.Actions>
                    <BeginStoryboard>
                        <Storyboard RepeatBehavior="3x">
                            <DoubleAnimation Storyboard.TargetProperty="X" From="0" To="10" 
                                                 AutoReverse="True" BeginTime="0:0:0" SpeedRatio="5"
                                                 Storyboard.TargetName="transformObj" Duration="0:0:0.5"/>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
            <Trigger Property="Button.IsMouseOver" Value="True">
                <Setter TargetName="EllB" Property="StrokeThickness" Value="6"/>
                <Setter TargetName="EllB" Property="Stroke" Value="#FEEC"/>
                <Setter TargetName="EllB" Property="Opacity" Value="0.7"/>
                <!--<Setter TargetName="EllB" Property="RenderTransform">
                        <Setter.Value>
                            <TransformGroup>
                                <ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
                                <SkewTransform AngleX="0" AngleY="0"/>
                                <RotateTransform Angle="0"/>
                                <TranslateTransform X="-10" Y="-10"/>
                            </TransformGroup>
                        </Setter.Value>
                    </Setter>-->
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

</ResourceDictionary>